package netTracker;

import java.io.Serializable;

public class Pattern implements Serializable{

	private static final long serialVersionUID = 1L;
	
	/** The tracks within the pattern. */
	Track[] tracks;
	Sequence sequence;
	
	/**
	 * Constructs a pattern.
	 * @param numTracks the number of tracks within the pattern.
	 * @param cellCount the number of cells in each track.
	 */
	public Pattern(int numTracks, int cellCount, Sequence sequence){
		this.sequence = sequence;
		tracks = new Track[numTracks];
		for (int i=0; i<tracks.length; i++)
			tracks[i] = new Track(cellCount, this);
	}
	
	/** @return the array tracks in the pattern. */
	public Track[] getTracks(){
		return tracks;
	}

	public double getTempo() {
		return sequence.getTempo();
	}

	public void clear() {
		for (int i=0; i<tracks.length; i++)
			tracks[i].clear();
	}	
}
